<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>合同分发</title>
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/product.css">
	<link rel="stylesheet" href="css/select-big.css">
	<style>
		.content-btn {
		    margin: 0 16px;
		}
		.product-child-content{
			width: 750px;
			margin: 0 auto;
		}
		.product-child-content .content-btn {
		    margin: 0;
		}
		.content-table-two tbody tr td input{
			width: 80%;
			height: 30px;
			line-height: 30px;
			background: #F9FBFF;
			border: 1px solid #ecf2f7;
			border-radius: 15px;
			text-align: center;
		}
		.icon-delImg{
			display: inline-block;
		    background: url(images/close-1.png)no-repeat;
		    width: 25px;
		    height: 25px;
		    cursor: pointer;
		}
		.icon-delImg:hover{
			background: url(images/close-1.png)no-repeat 0 -27px;
		}
		.divLeft {
		    float: right;
		    width: auto;
		    display: inline-block;
		    margin-top: -35px;
		}
		.content-table-newservice {
		    width: 88%;
		    margin: 10px auto;
		}
		.content-table-newservice tbody tr td:nth-child(odd){
			width: 100px;
		}
		.content-table-newservice tbody tr td{
			border-bottom:1px solid #f5f5f5;
		}
		.content-table-newservice tbody tr:last-child td{
			border-bottom:0px solid #f5f5f5;
		}
		.content-table-newservice tbody tr td p{
			display: inline-block;
		    width: 640px;
		    min-height: 30px;
		    margin-top: 15px;
		    word-wrap: break-word;
		    line-height: 20px;
		}
	</style>
</head>
<body style="background:#fff;">
<div class="main-content-box">
	<div stype = "display:none;" id = "init">
		<form id = "seachContractInboundForm">
			<input type = "hidden" name = "expressInbound.expressid">
		</form>
	</div>
	<div class="content-list">
		<table class="content-table-newservice" cellspacing="0" cellpadding="0">
			<tbody>
				<tr>
					<td><span>项目编号：</span></td>
					<td id = "projectcode"></td>
					<td><span>项目名称：</span></td>
					<td id = "projectname"></td>
				</tr>
				<tr>
					<td>可分发数量：</td>
					<td colspan="3"><p id = "number"></p></td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="product-child-content">
		<div class="content-info">
			<div class="content-btn bot-line">
				<span class="title-info">纸质合同信息</span>
			</div>
			<div style = "display:none;">
				<form id = "appointForm">
					<input type = "text" name = "projectcode" >
					<input type = "text" name = "printer" >
					<input type = "text" name = "status" value = "0" >
				</form>
			</div>
			<table id = "table" dataAction = "/appoint/findAllList" bindForm = "appointForm" class="tableOrder content-table-two matop" datatable = "true"  cellspacing="0" cellpadding="0" >
				<tbody style = "display:none;">
					<th style="width:100px;" title = "客户编号" name = "custcode" type = "string"></th>
					<th style="width:250px;" title = "客户名称" name = "custname" type = "string"></th>
					<th style="width:100px;" title = "理顾姓名" name = "isname" type = "string"></th>
					<th style="width:100px;" title = "预约金额" name = "transfercash" type = "string"></th>
					<th style="width:100px;" title = "预约时间" name = "transferdate" type = "string"></th>
					<th style="width:100px;" title = "预约状态" name = "status" type = "string"></th>
				</tbody>
			</table>
		</div>
		<button class="save-btn matop" id = "confirm">确认</button>
	</div>
</div>
	<script src="js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
	<script src="js/select.jquery.js"></script>
	<script type="text/javascript" src = "js/util.js"></script>
	<script>
		$(document).ready(function(){
			var data = parent.data[0];
			$("input[name='projectcode']").val(data.projectcode);
			$("input[name='printer']").val(data.printer);
			$("#projectname").text(data.projectname);
			$("#projectcode").text(data.projectcode);
			$("#number").text(data.disContract);
			$("#confirm").click(function(){
				var list = $("#table").getCheckData();
				if(list.length < 1){
					layer.msg("请选择记录");
					return;
				}
				var param = new FormData();
				param.append("projectcode",data.projectcode);
				param.append("department",data.department?data.department:"");
				param.append("printer",data.printer);
				for(var i = 0 ; i < list.length ; i++){
					param.append("apps[" + i + "].reserveNo",list[i].reserveNo);
					param.append("apps[" + i + "].iscode",list[i].iscode);
					param.append("apps[" + i + "].id",list[i].id);
				}
				//param.append("appoints",list);
				$.ajax({
			        type: 'post',
			        url:baseUrl + "/contractInbound/saveDistributes",
			        contentType: false,  
			        processData: false, 
			        async: false,
			        data:param
				}).done(function(dt){
					parent.layer.msg(dt);
				});
			});
		});
		function tableCallBack (my){
			my.find("thead").find("tr").prepend("<td><input type=\"checkbox\"></td>");
			var $tr = my.find("tbody").eq(1).find("tr");
			for(var i = 0 ; i < $tr.length ; i++){
				var html = "<td><input type=\"checkbox\"></td>";
				$($tr[i]).prepend(html);
			}
			my.find("thead").find("input[type='checkbox']").click(function(){
				var $this = $(this);
				my.find("tbody").find("input[type='checkbox']").prop("checked",$this.is(":checked"));
			});
			my.next().remove();
        }
	</script>
	<script type="text/javascript" src = "js/table.js"></script>
</body>
</html>